package org.aclyyx.malata.app.e4;

import java.io.File;
import java.util.Map;

import org.aclyyx.malata.app.StaticData;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		try {
			HSSFWorkbook wb;
			ReadFile1 rf1	= new ReadFile1();
			ReadFile2 rf2	= new ReadFile2();
			CompareFile cf	= new CompareFile();
			WriteFile2 wf	= new WriteFile2();
			
			rf1.read();
			
			Map<String, Integer> map = rf1.map;
			
			File path = new File(StaticData.E4_S2);
			if (path.exists() && path.isDirectory() && path.list().length > 0) {
				for (String file : path.list()) {
					System.out.println(file);
					wb = rf2.read(file);
					if (wb != null) {
						wb = cf.compare(map, wb);
						wf.write(wb, file);
					}
				}
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
